package com.hfi.security.core.properties;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * 使SecurityProperties生效
 * @author ChangLiang
 * @date 2019/8/6
 */
@Configuration
@EnableConfigurationProperties(SecurityProperties.class)
public class SecurityCoreConfig {

    /**
     * 这个在browser项目和app项目中都是会使用到的
     * @return
     */
    @Bean
    public PasswordEncoder passwordEncoder() {
        // 如果在我们系统中是MD5加密的 那么就写一个自己的PasswordEncoder
        return new BCryptPasswordEncoder();
    }
}
